const mongoose = require('mongoose');
const bcrypt = require('bcryptjs');

const Schema = mongoose.Schema,
    ObjectId = Schema.ObjectId;

/**
 * 推送给客户的状态报告结构
 * @type {mongoose.Schema}
 */
let schema = new Schema({
    msg_id : String, //mt_msg_id
    mobile : String,
    status : String, //0=成功，其他失败
    desc : String, //DELIVD表示成功
    report_date : String,
    send_date : String,
    pieces : Number,
    ext : String,
    ticket : String,  //customer_msg_id
    ref : String,
    iso_code : String,

    cus_id : String,
    create_time : {type : Date, default : Date.now},
    update_time : {type : Date, default : Date.now},
    push_time : {type : Date},
    lock : {type : String, default : ''},
    push_status : {type : Number, default : 0}, //0 = 未推送，1=推送成功，2=推送失败
    try_times : {type : Number, default : 0},
    type : Number, //1 = push ,2 = get
});

//添加lock和update_time的索引方便快速查询

let model = mongoose.model('customer_report', schema);

module.exports = model;
